<?php
 if(!$logged_in) exit();
?>
<h1>Nachrichten</h1>


<table class="messages">
<tr><th>&nbsp;</th><th>Von</th><th>Betreff</th></tr>
<?php
$r = db_query("SELECT * FROM messages WHERE `to`='".secure_mysql_string($_SESSION["user"])."' ORDER BY date DESC");
while(($v = mysql_fetch_array($r)) != NULL) {
 $stat = "_read";
 if($v["flags"] & FLAG_UNREAD) $stat = "_unread";

 echo "<tr>";
 echo "<td><input type=\"checkbox\"></td>";
 echo "<td>".$v["from"]."<br><span class='message_date'>".date("d.m.Y H:i", $v["date"])."</span></td><td><span class='message_subj$stat'>".$v["subject"]."</span><br><span class='message_text_prev'>".$v["text"]."</span></td>";
 echo "</tr>";
}

?>

